package com.yxinsur.imc.web.core.config;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author imc
 */
@Configuration
public class SnowflakeConfig {

    @Value("${sys.workerId}")
    private int workerId;
    @Value("${sys.datacenterId}")
    private int datacenterId;


    @Bean
    public Snowflake getSnowflake() {
        return IdUtil.getSnowflake(workerId, datacenterId);
    }
}
